#ifndef __WIZ_BASE_UTILS_PTR_HPP__SHANHAOBO__19800429__
#define __WIZ_BASE_UTILS_PTR_HPP__SHANHAOBO__19800429__

#include "../WizBaseTemplateUtils.hpp"
#include "./WizBaseUtilsUnspecifiedBool.hpp"

namespace Wiz
{
    namespace Ptr
    {
        template<class RawT>
        struct Type : public ::Wiz::UnspecifiedBool::Type< Type<RawT> >
        {
        protected:
            typedef Type                tThis;
            typedef RawT                tRaw;
            typedef tRaw&               tRawRef;
            typedef tRaw const&         tRawRefConst;
            typedef tRaw*               tRawPtr;
            typedef tRaw const*         tRawConstPtr;
            typedef tRaw const * const  tRowFixedConstPtr;
            tRawPtr                     m_RawPtr;      /// ManagedPtr
        public:
            ////////////////////////////////////////////////////////////////////////
            /// For ::Wiz::UnspecifiedBool::Type
            ::Wiz::Bool::Type IsTrue() const
            {
                return this->IsValid();
            }
            ////////////////////////////////////////////////////////////////////////
        public:
            Type() : m_RawPtr(WIZ_NULLPTR)
            {
            }
            Type(tRawPtr ObjPtr) : m_RawPtr(ObjPtr)
            {
            }
            Type(tThis const & Other) : m_RawPtr(Other.m_RawPtr)
            {
            }
        public:
            ::Wiz::Bool::Type NotValid() const
            {
                return ::Wiz::NotValidPtr(this->m_RawPtr);
            }
            ::Wiz::Bool::Type IsValid() const
            {
                return !(this->NotValid());
            }
            ::Wiz::Bool::Type operator!() const
            {
                return this->NotValid();
            }
        public:
            operator tRawPtr() const
            {
                return m_RawPtr; 
            }
        public:
            tRawConstPtr operator->() const
            {
                return m_RawPtr; 
            }
            tRawPtr operator->()
            {
                return m_RawPtr; 
            }
        public:
            tRawRefConst operator*() const
            {
                return *m_RawPtr; 
            }
            tRawRef operator*()
            {
                return *m_RawPtr; 
            }
        public:
            ::Wiz::Void::Type Swap(tThis & rhs)
            {
                tRawPtr tmp = m_RawPtr;
                m_RawPtr = rhs.m_RawPtr;
                rhs.m_RawPtr = tmp;
            }
        public:
            tRowFixedConstPtr GetRawPtr() const
            {
                return m_RawPtr;
            }
            tRawPtr& GetRawPtr()
            {
                return m_RawPtr;
            }
        };
    } /// end of namespace Ptr
} /// end of namespace Wiz

#endif /*__WIZ_BASE_UTILS_PTR_HPP__SHANHAOBO__19800429__*/
